package com.oocl.admin_platform.service.impl;


import com.oocl.admin_platform.dao.ManagerDao;
import com.oocl.admin_platform.dao.factory.DaoFactory;
import com.oocl.admin_platform.pojo.Manager;
import com.oocl.admin_platform.pojo.Merchant;
import com.oocl.admin_platform.service.ManagerService;


public class ManagerServiceImpl implements ManagerService{

	private ManagerDao managerDao;
	
	
	

	

	public void setManagerDao(ManagerDao managerDao) {
		this.managerDao = managerDao;
	}

	public ManagerServiceImpl() {
		// TODO Auto-generated constructor stub
		managerDao=DaoFactory.getManagerDaoInstance();
		
	}
	
	@Override
	public Manager findByuname(String uname) {
		// TODO Auto-generated method stub
		return managerDao.findByuname(uname);
	}

	@Override
	public Manager validatePasswordAndReturnManager(String uname, String password) {
		// TODO Auto-generated method stub
		Manager manager=managerDao.findByuname(uname);
		if (manager!=null&&manager.getPassword().equals(password)) {
			return manager;
		}
		return null;
	}
	
	public boolean checkNameForLogin(String uname) {
		Boolean vaild = true;
		if (managerDao.findByuname(uname)==null) {
			vaild = false;
		}
		return vaild;
	}
	
	
}
